import HttpService from '../../app/services/httpService.js';

class RunnerService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	RunnerCreateUrl: this.URL + '/runner/create?race_id=',
            RunnerDetailUrl: this.URL + '/runner/detail?runner_id=',
            RunnerUpdateUrl: this.URL + '/runner/update?runner_id=',
            RunnerDelUrl: this.URL + '/runner/del?race_id=',
            RunnerClearUrl: this.URL + '/runner/clear?race_id=',
            RunnerImportUrl: this.URL + '/runner/import?race_id=',
            RunnerBindingUrl: this.URL + '/runner/binding?race_id=',
            RunnerClaimpackUrl: this.URL + '/runner/claimpack?runner_id=',
        }

    }

    /* 创建选手 */
    postRunnerCreate(params, headers, search) {
        return this.postRequest(this.OBJ.RunnerCreateUrl, params, headers, search);
    }

    /* 获取选手详情 */
    getRunnerDetail(headers, search) {
        return this.getRequest(this.OBJ.RunnerDetailUrl, headers, search);
    }

    /* 更新选手详情 */
    postRunnerUpdate(params, headers, search) {
        return this.postRequest(this.OBJ.RunnerUpdateUrl, params, headers, search);
    }

    /* 删除选手 */
    postRunnerDel(params, headers, search) {
        return this.postRequest(this.OBJ.RunnerDelUrl, params, headers, search);
    }

    /* 清空选手 */
    postRunnerClear(params, headers, search) {
        return this.postRequest(this.OBJ.RunnerClearUrl, params, headers, search);
    }

    /* 导入选手信息 */
    postRunnerImport(params, headers, search) {
        return this.postMultipart(this.OBJ.RunnerImportUrl, params, headers, search);
    }

    /* 绑定选手 */
    getRunnerBinding(headers, search) {
        return this.getRequest(this.OBJ.RunnerBindingUrl, headers, search);
    }

    /* 改变选手领取赛包状态 */
    postRunnerClaimpack(headers, search) {
        return this.postRequest(this.OBJ.RunnerClaimpackUrl, {}, headers, search);
    }

}

export default RunnerService;